import {core, GameObject, registerScript} from "./gameengine";
import {
    marshal,
    // MarshalLandingState,
    // MarshalConversationTestState,
    // MarshalItemTestState,
    // MarshalDemoState,
    // MarshalMapTestState, MarshalLockerState, MalshalChangeSceneTestState,
    MarshalStartState,
    MarshalItemTestState,
    MarshalDemoState
} from "./marshal";
// import { LandingBehaviour } from "./scene/landingBehaviour";
// import { EntranceBehaviour } from "./scene/entranceBehaviour";
import { ConversationTest } from "./conversation/conversationTest";
import { ItemLayerBehaviour, ItemBehaviour, PickItemBehaviour, DoorBehaviour, HiddenClueBehaviour, DisappearBehaviour } from "./item/item";
import {MainRoleBehaviour} from "./mainRoleBehaviour";
import {Rect_Collider} from "./collider/rect_Collider";
import {ColliderSystem} from "./collider/colliderSystem";
import {SceneFollow} from "./SceneFollow/sceneFollow";
import { TileMapRenderer } from "./tilemap";
import {AnimationRenderer} from "./AnimationRenderer";
import {JsonBehaviour} from "./jsonBehaviour";
// import { LockInstantiate } from "./lock/lockInstantiate";
import { MissionSystem } from "./mission/missionSystem";
import {IconBehaviour} from "./backpack/icon";
import { ItemSystem } from "./item/itemSystem";
import {music} from "./music/music";
import {plot} from "./plot/plot";
import {StartPlotBehaviour} from "./plot/startPlot";
import {PlotTestBehaviour} from "./plot/plotTest";
import {StartButtonBehaviour} from "./startButton";
import { anim_alpha, anim_scale } from "./anim_show";



registerScript(ConversationTest);
registerScript(ItemLayerBehaviour);
registerScript(ItemBehaviour);
registerScript(Rect_Collider);
registerScript(MainRoleBehaviour);
registerScript(ColliderSystem);
registerScript(TileMapRenderer);
registerScript(SceneFollow);
registerScript(AnimationRenderer);
registerScript(JsonBehaviour);
// registerScript(LockInstantiate);
registerScript(PickItemBehaviour);
registerScript(DoorBehaviour);
registerScript(MissionSystem);
registerScript(IconBehaviour);
registerScript(ItemSystem);
registerScript(HiddenClueBehaviour);
registerScript(StartPlotBehaviour);

//测试用
registerScript(PlotTestBehaviour);

registerScript(StartButtonBehaviour);
registerScript(anim_alpha);
registerScript(DisappearBehaviour);

//lock
core.loadImage("assets/picture/locker.png");
core.loadImage("assets/picture/locker_new.png");
core.loadImage("assets/picture/1.png");
core.loadImage("assets/picture/2.png");
core.loadImage("assets/picture/3.png");
core.loadImage("assets/picture/4.png");
core.loadImage("assets/picture/5.png");
core.loadImage("assets/picture/6.png");
core.loadImage("assets/picture/7.png");
core.loadImage("assets/picture/8.png");
core.loadImage("assets/picture/9.png");

core.loadImage("assets/picture/conversationBg.png");
core.loadImage("assets/picture/corridor.png");
core.loadImage("assets/picture/player_1.png");
core.loadImage("assets/picture/player.png");
core.loadImage("assets/item/guizi.png");
core.loadImage("assets/item/door.png");

core.loadImage("assets/tilemap/0.png");
core.loadImage("assets/tilemap/1.png");
core.loadImage("assets/tilemap/2.png");
core.loadImage("assets/tilemap/3.png");
core.loadImage("assets/tilemap/4.png");
core.loadImage("assets/tilemap/5.png");
core.loadImage("assets/tilemap/6.png");
core.loadImage("assets/tilemap/7.png");
core.loadImage("assets/tilemap/8.png");
core.loadImage("assets/tilemap/9.png");
core.loadImage("assets/tilemap/10.png");
core.loadImage("assets/tilemap/11.png");
core.loadImage("assets/tilemap/21.png");
core.loadImage("assets/tilemap/22.png");
core.loadImage("assets/tilemap/23.png");
core.loadImage("assets/tilemap/24.png");
core.loadImage("assets/tilemap/25.png");
core.loadImage("assets/tilemap/26.png");
core.loadImage("assets/tilemap/27.png");
core.loadImage("assets/tilemap/28.png");
core.loadImage("assets/tilemap/31.png");
core.loadImage("assets/tilemap/41.png");
core.loadImage("assets/tilemap/51.png");
core.loadImage("assets/tilemap/61.png");
core.loadImage("assets/tilemap/71.png");
core.loadImage("assets/tilemap/101.png");
core.loadImage("assets/tilemap/500.png");
core.loadImage("assets/tilemap/501.png");
core.loadImage("assets/tilemap/502.png");
core.loadImage("assets/tilemap/503.png");
core.loadImage("assets/tilemap/504.png");
core.loadImage("assets/tilemap/505.png");
core.loadImage("assets/tilemap/506.png");
core.loadImage("assets/tilemap/507.png");
core.loadImage("assets/tilemap/508.png");
core.loadImage("assets/tilemap/509.png");
core.loadImage("assets/tilemap/900.png");

core.loadImage("assets/picture/anim.png");
core.loadImage("assets/picture/mask.png");
core.loadImage("assets/picture/mask_yellow.png");
core.loadImage("assets/picture/mask_m.png");
core.loadImage("assets/picture/mask_m_yellow.png");
core.loadImage("assets/picture/mask_bbb.png");
core.loadImage("assets/picture/mask_bbb_yellow.png");
core.loadImage("assets/picture/mask_black.png");
core.loadImage("assets/picture/blood.png");


core.loadImage("assets/item/bed.png");
core.loadImage("assets/item/bin.png");
core.loadImage("assets/item/cat.png");
core.loadImage("assets/item/blackchairA.png");
core.loadImage("assets/item/blackchairB.png");
core.loadImage("assets/item/chairA.png");
core.loadImage("assets/item/chairB.png");
core.loadImage("assets/item/chairC.png");
core.loadImage("assets/item/chairD.png");
core.loadImage("assets/item/chairE.png");
core.loadImage("assets/item/chaji.png");
core.loadImage("assets/item/desk_datingA.png");
core.loadImage("assets/item/desk_datingB.png");
core.loadImage("assets/item/desk_datingC.png");
core.loadImage("assets/item/desk_office.png");
core.loadImage("assets/item/desk_zhenshi.png");
core.loadImage("assets/item/dialog.png");
core.loadImage("assets/item/ditan.png");
core.loadImage("assets/item/door_ward.png");
// core.loadImage("assets/item/door_zhenshi.png");
core.loadImage("assets/item/door.png");
core.loadImage("assets/item/guizi.png");
core.loadImage("assets/item/fengziA.png");
core.loadImage("assets/item/fengziB.png");
core.loadImage("assets/item/fengziC.png");
core.loadImage("assets/item/guancai.png");
core.loadImage("assets/item/guizi_taipingjian.png");
core.loadImage("assets/item/jiaoyinA1.png");
core.loadImage("assets/item/jiaoyinA2.png");
core.loadImage("assets/item/jiaoyinA3.png");
core.loadImage("assets/item/jiaoyinB1.png");
core.loadImage("assets/item/jiaoyinB2.png");
core.loadImage("assets/item/knife.png");
core.loadImage("assets/item/label.png");
core.loadImage("assets/item/lian_ce.png");
core.loadImage("assets/item/lian.png");
core.loadImage("assets/item/matong.png");
core.loadImage("assets/item/screen.png");
core.loadImage("assets/item/shugui.png");
core.loadImage("assets/item/shuichi_F.png");
core.loadImage("assets/item/shuichi.png");
core.loadImage("assets/item/shuye.png");
core.loadImage("assets/item/sofaA.png");
core.loadImage("assets/item/sofaB.png");
core.loadImage("assets/item/tree.png");
core.loadImage("assets/item/window.png");
core.loadImage("assets/item/xiaobian.png");
core.loadImage("assets/item/yijia.png");
core.loadImage("assets/item/yugang.png");
core.loadImage("assets/item/stair_up.png");
core.loadImage("assets/item/stair_down.png");
// core.loadImage("assets/item/fengzi.png");
core.loadImage("assets/item/vision.png");
core.loadImage("assets/item/paper.png");
core.loadImage("assets/item/gate.png");
core.loadImage("assets/item/gateDoor.png");
core.loadImage("assets/item/gateWall.png");
core.loadImage("assets/item/zhalan_l.png");
core.loadImage("assets/item/zhalan_r.png");
core.loadImage("assets/item/blood.png");

core.loadImage("assets/picture/backPack.png");
core.loadImage("assets/picture/ironKey.png");
core.loadImage("assets/picture/E.png");
core.loadImage("assets/picture/description.png");
core.loadImage("assets/picture/frame.png");


//背包里的图片
core.loadImage("assets/picture/backpack/bag.png");
core.loadImage("assets/picture/backpack/candle1.png");
core.loadImage("assets/picture/backpack/candle2.png");
core.loadImage("assets/picture/backpack/crazyWord.png");
core.loadImage("assets/picture/backpack/diary.png");
core.loadImage("assets/picture/backpack/E.png");
core.loadImage("assets/picture/backpack/fire.png");
core.loadImage("assets/picture/backpack/goldenKey.png");
core.loadImage("assets/picture/backpack/ironKey.png");
core.loadImage("assets/picture/backpack/knife.png");
core.loadImage("assets/picture/backpack/noteMan.png");
core.loadImage("assets/picture/backpack/notes.png");
core.loadImage("assets/picture/backpack/R.png");
core.loadImage("assets/picture/backpack/gun.png");
core.loadImage("assets/picture/backpack/statue.png");
core.loadImage("assets/picture/backpack/stone.png");

core.loadImage("assets/picture/backpack/gun_grey.png");
core.loadImage("assets/picture/backpack/fire_grey.png");

//预览图片
core.loadImage("assets/picture/preview/chapter1.png");
core.loadImage("assets/picture/preview/chapter4.png");
core.loadImage("assets/picture/preview/chapter6.png");
core.loadImage("assets/picture/preview/chapter7.png");
core.loadImage("assets/picture/preview/chapter9.png");
core.loadImage("assets/picture/preview/diary_content.png");
core.loadImage("assets/picture/preview/noteMan_content.png");

//useBtn
core.loadImage("assets/picture/use.png");

//plotImages:开始和结局图片播放
core.loadImage("assets/picture/plot/fengzi_pic.png");
core.loadImage("assets/picture/plot/fengzi_pic2.png");
core.loadImage("assets/picture/plot/end1_1.png");
core.loadImage("assets/picture/plot/end1_2.png");

core.loadImage("assets/picture/plot/end2_1.png");
core.loadImage("assets/picture/plot/end2_2.png");

core.loadImage("assets/picture/plot/end3_1.png");
core.loadImage("assets/picture/plot/end3_2.png");
core.loadImage("assets/picture/plot/end3_3.png");
core.loadImage("assets/picture/plot/end3_4.png");
core.loadImage("assets/picture/plot/end3_5.png");
core.loadImage("assets/picture/plot/end3_6.png");
core.loadImage("assets/picture/plot/end3_7.png");


core.loadImage("assets/picture/plot/start1.png");
core.loadImage("assets/picture/plot/start2.png");
core.loadImage("assets/picture/plot/start3.png");
core.loadImage("assets/picture/plot/start4.png");
core.loadImage("assets/picture/plot/start5.png");
core.loadImage("assets/picture/plot/start6.png");
core.loadImage("assets/picture/plot/start7.png");
core.loadImage("assets/picture/plot/start8.png");
core.loadImage("assets/picture/plot/start9.png");
core.loadImage("assets/picture/plot/start10.png");
core.loadImage("assets/picture/plot/start11.png");
core.loadImage("assets/picture/plot/start12.png");

//开始和结束的button
core.loadImage("assets/picture/button/btn_kill.png");
core.loadImage("assets/picture/button/btn_success.png");

//开始界面
core.loadImage("assets/picture/start.png");
core.loadImage("assets/picture/button/btn_start.png");



core.start();
// window.onload=()=>{
//     music.bgPlay();
// };

music.bgPlay();
// marshal.changeState(new MarshalLandingState());
// marshal.changeState(new MarshalConversationTestState());
// marshal.changeState(new MarshalItemTestState());
setTimeout(() =>{
    marshal.changeState(new MarshalStartState());
},1000)
// marshal.changeState(new MarshalDemoState());
// marshal.changeState(new MarshalDemoState());
// marshal.changeState(new MarshalMapTestState());
// marshal.changeState(new MarshalLockerState());
// marshal.changeState(new MalshalChangeSceneTestState());



